package com.cst.words.controller;

import com.cst.words.common.R;
import com.cst.words.pojo.Vocabulary;
import com.cst.words.service.VocabularyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : CST
 */
@Slf4j
@RestController
@RequestMapping("/vocabulary")
public class VocabularyController {
    @Autowired
    private VocabularyService vocabularyService;


    @GetMapping("/search")
    public Vocabulary search(String word){
        log.info("查单词"+word);
       return vocabularyService.getDescribeByWord(word);
    }

    @GetMapping("/example")
    public Vocabulary findUsagesById(@RequestParam("id") Integer id){
        return  vocabularyService.getExampleById(id);
    }

}
